package com.type.web;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.type.service.TypeThreeService;
import com.type.vo.ListAlarmVO;

@Controller
public class TypeThreeController {

	/**
	 * 전체 알림리스트 목록 출력
	 */
	@Resource(name="TypeThreeService")
	private TypeThreeService service;
	
	@RequestMapping("/typeThree.do")
	public String AlarmList(Model model, @RequestParam(value="page", required=false) String page){
		ListAlarmVO listAlarm = null;
		int numPage=1;
		try{
			if(page!=null){
				numPage = Integer.parseInt(page);
			}else{
				numPage=1;
			}
			listAlarm = service.selectAlarmListByPaging(numPage);
			model.addAttribute("listAlarm", listAlarm);
			model.addAttribute("page",page);
		}catch(Exception e){
			e.printStackTrace();
			model.addAttribute("message", "리스트 뷰 과정에서 오류가 발생했습니다.");	
		}
		return "/type/typeThree";
	}
	
}
